<?php
namespace mvc\web;

class Controller
{
    /* @var $view View */
    public $view;
    public $layout = 'main';

    public function __construct()
    {
        $this->view = Application::getComponent('view');
        $this->view->context = $this;
    }

    public function render($file, $var)
    {
        return $this->view->render($file, $var);
    }

    public function jsonResponse($data)
    {
        exit(json_encode($data));
    }
}